import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BoxVO, BoxForm, BoxQuery } from '@/api/system/box/types';

/**
 * 查询福盒列表
 * @param query
 * @returns {*}
 */

export const listBox = (query?: any)=> {
  return request({
    url: '/system/luckBox/queryLuckBoxList',
    method: 'get',
    params: query
  });
};

/**
 * 查询福盒详细
 * @param id
 */
export const getBox = (id: string | number): AxiosPromise<BoxVO> => {
  return request({
    url: '/system/luckBox/' + id,
    method: 'get'
  });
};

/**
 * 新增福盒
 * @param data
 */
export const addBox = (data: BoxForm) => {
  return request({
    url: '/system/luckBox',
    method: 'post',
    data: data
  });
};

/**
 * 修改福盒
 * @param data
 */
export const updateBox = (data: BoxForm) => {
  return request({
    url: '/system/luckBox',
    method: 'put',
    data: data
  });
};

/**
 * 删除福盒
 * @param id
 */
export const delBox = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/luckBox/' + id,
    method: 'delete'
  });
};

/**
 * 上下架
 * @param id
 */
export const updateLuckBoxStatus = (id: string | number, status: string) => {
  return request({
    url: '/system/luckBox/updateLuckBoxStatus?id=' + id + '&status=' + status,
    method: 'post'
  });
};
